package com.lotusfall.controller;

import com.lotusfall.pojo.Student;
import com.lotusfall.service.StudentService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DController {
    /**
     * 引用远程服务，吧创建好的代理对象，诸如给studentService
     */
    // @DubboReference(interfaceClass = StudentService.class,version = "1.0" )
    @DubboReference(version = "1.0" )
    private StudentService studentService;

    @GetMapping("/query")
    public String queryString(Integer id){
        Student student = studentService.queryStudent(id);
        return "调用远程接口，获取对象 : " + student;
    }
}